import { request } from '../utils/request'

type myUserInfo = {
  token: string
  refreshToken: string
  avatar: string
  mobile: string
  account: string
  id: string
}

// 账号和密码登录的请求
export const loginRequest = (data) => {
  return request<myUserInfo>('/login/password', 'POST', data)
}

// 获取验证码
export const getCodeRequest = (data): any => {
  return request('/code', 'GET', data)
}

// 根据手机号和验证码来登录的接口
export const loginByCodeRequest = (data) => {
  return request<any>('/login', 'POST', data)
}

// /patient/myUser
export const getPatientUserInfo = () => {
  return request<any>('/patient/myUser', 'GET')
}

// 查询患者的列表接口 -- 家庭档案
export const getPatientListRequest = () => {
  return request<any>('/patient/mylist', 'GET')
}

// 添加患者
export const addPatientRequest = (data) => {
  return request<any>('/patient/add', 'POST', data)
}
// 更新患者
export const updatePatientRequest = (data) => {
  return request<any>('/patient/update', 'PUT', data)
}
